// Aloudin (Albert) Akhriev, 1998-2001.

#ifndef  ALIB_GAUSS_FILTER_H
#define  ALIB_GAUSS_FILTER_H

#include "math/AFilter.h"

//==========================================================================
// Class generates and keeps odd number of Gauss filters with slightly
// different variances. Class contains both smoothing and differentiating
// filters.
// Smoothing:       sf(x) = exp(-x^2/(2*sigma^2)) / (sigma*sqrt(2*PI))
// Differentiating: df(x) = x*exp(-x^2/(2*sigma^2)) / (sigma^3*sqrt(2*PI))
// Double diff.:   ddf(x) = (x^2/sigma^2-1)*exp(-x^2/(2*sigma^2)) / (sigma^3*sqrt(2*PI))
//==========================================================================
class GaussFilter : public AFilter
{
 private:
  void   ComputeFilter(float * sf, float * df, float * ddf, double sigma);
  int    GetFilterLength(int nFilter, double sigma, double dSigma);
  double ValidateParameter(double sigma);

 public:
  GaussFilter()  { Clear(); }
  ~GaussFilter() { Clear(); }
  int Type() const;
};

#endif   // ALIB_GAUSS_FILTER_H
